<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('setting',$postdata);
		exi('设置成功');
	}
	$footernav =array(
		array('title'=>'分红中心','icon'=>'icon-shouye','action'=>'jy_quanfee/index/'),
		array('title'=>'分红佣金','icon'=>'icon-yiban','action'=>'jy_quanfee/commission/'),
		array('title'=>'分红订单','icon'=>'icon-dingdan','action'=>'jy_quanfee/orderfee/'),
		array('title'=>'我的下线','icon'=>'icon-paihao0','action'=>'jy_quanfee/down/'),
	);	
	$return['item']=$this->plugin_setting('setting');
	$return['item']['yao_feetype']=$return['item']['yao_feetype']?:0;
	$return['item']['footernav']=$return['item']['footernav']?:$footernav;
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基础设置',
				'list'=>array(
					array('type'=>'switch','title'=>'是否启用','name'=>'isopen','isradio'=>1),
					array('name'=>'commissionfeetype','title'=>'佣金金额计算方式','type'=>'radio','help'=>'第一种：按商品实际成交价×百分比；第二种：按商品利润：【实际成交价-成本】×百分比；','options'=>'commissiontypes'),
				)
			),
			array(
				'title'=>'上下线关系及分红资格',
				'list'=>array(
					array('type'=>'radio','title'=>'成为下线条件','name'=>'become_child','options'=>'become_child'),
					array('type'=>'radio','title'=>'成为分红商条件','name'=>'become','options'=>'become','help'=>'如果是无条件，将自动成为分红商！无需填写申请！【<red>注意</red>】:设置了《无条件》成为分红商。然后《首次下单，首次付款》是不会再绑定上下关系的。因为已经是分红商的不能成为别人的下级，除非在成为分红商之前成为别人的下级。'),
					array('type'=>'choose_many','name'=>'become_goods','title'=>'购买商品成为分红商','show'=>array('become'=>4),'action'=>'jy_weishop/goods.get_goods/many/','choose_title'=>'选择参与的商品'),
					array('type'=>'string','title'=>'消费次数达到（次）','name'=>'num','show'=>array('become'=>2)),
					array('type'=>'string','title'=>'消费金额达到（元）','name'=>'money','show'=>array('become'=>3)),
					array('type'=>'radio','title'=>'分红商是否需要审核','name'=>'become_check','options'=>'is'),
					array('type'=>'radio','title'=>'分红商必须完善资料','name'=>'become_reg','options'=>'is'),
				)
			),
			array(
				'title'=>'结算',
				'list'=>array(
					array('type'=>'choose_many','name'=>'admin_ids','title'=>'通知管理员','choose_title'=>'选择通知人','help'=>'如不填写，则不发送结算通知给管理员','action'=>'core/member.get_member/many'),
					array('type'=>'checkbox','title'=>'不支持分佣的支付方式','name'=>'pay_type','options'=>'pay_type','help'=>'<red>勾选不支持分佣的；如果一半的支持，一半抵扣又不支持，则只计算真实《支持支付方式的金额》，不支持的将减去！</red>'),
					array('type'=>'switch','title'=>'提现是否扣除等量积分？','name'=>'balance_difee'),
					array('type'=>'checkbox','title'=>'支持的提现方式','name'=>'withdrawtype','options'=>'withdraw'),
					array('type'=>'string','title'=>'结算额度（元）','name'=>'balance_money','help'=>'佣金达到该数值才能结算'),
					array('type'=>'string','title'=>'佣金打款手续费（%）','name'=>'balance_per'),
					array('type'=>'radio','title'=>'佣金计算方式','name'=>'commissiontype','options'=>'commissiontype','help'=>''),
					array('type'=>'switch','title'=>'下单即可结算？','name'=>'isbuy_jiesuan','help'=>'不开启，则表示，必须完成订单才能结算！'),
					array('type'=>'string','title'=>'免手续费提现区间开始金额','name'=>'balance_money_start'),
					array('type'=>'string','title'=>'免手续费提现区间结束金额','name'=>'balance_money_end','help'=>'当提现手续费金额在此区间内时,不扣除提现手续费. 结束金额 必须大于 开始金额才能生效'),
					array('type'=>'string','title'=>'结算天数','name'=>'balance_day','help'=>'当订单完成后的n天后，佣金才能申请提现,设置0或空，订单完成就可以结算'),
				),
			),
			array(
				'title'=>'分红商等级升级',
				'list'=>array(
						array('type'=>'switch','title'=>'满足其中一个条件就升级','name'=>'is_level_up_one','help'=>'默认，勾选的条件都要满足才行！'),
						array('type'=>'checkbox','title'=>'分红商升级依据','name'=>'level_up_types','options'=>'leveltype','help'=>'开启《指定购买商品》后，可以在分红等级设置不同的商品！'),		
					)
			),
			array(
				'title'=>'DIY设置',
				'list'=>array(
					array('type'=>'array','title'=>'分红中心DIY菜单','name'=>'bankuai','add_tip'=>'添加一个菜单',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'菜单名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'菜单图标'),
										array('type'=>'string','name'=>'action','title'=>'菜单链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'菜单名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'菜单图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'菜单链接'),
									)
					),
					array('type'=>'string','title'=>'分享标题','name'=>'share_title'),
					array('type'=>'image','title'=>'分享图片','name'=>'share_image'),
					array('type'=>'string','title'=>'分享描述','name'=>'share_desc'),
					array('type'=>'link','from'=>'action','title'=>'分享/二维码跳转链接','name'=>'share_link','help'=>'默认跳转到小店，指定链接后，跳转到指定页面！'),
				)
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
								array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
		)
	);
	$return['leveltype']=$this->level_up_types;
	$return['withdraw']=$this->pay_types;
	$return['commissiontypes']=$this->commission_types2;
	$return['commissiontype']=$this->commission_types;
	$return['area_type']=array('0'=>'独家代理','1'=>'普通代理');
	$return['is']=array('0'=>'否','1'=>'是');
	$return['become_child']=array('1'=>'首次点击链接','2'=>'首次下单','3'=>'首次付款','4'=>'扫上级分红码');
	$return['become']=array('0'=>'无条件','1'=>'申请','2'=>'消费次数','3'=>'消费金额','4'=>'购买商品','5'=>'扫上级分红码');
	$return['showgetfee']=array('0'=>'不显示','1'=>'全部可见','2'=>'仅代理商可见');
	$return['level']=$this->level_types;
	$return['gift_type']=$this->gift_type;
	$return['levelfee_type']=$this->levelfee_type;
	$return['pay_type']=get_pay_types();
	$return['htmls']=$htmls;
	exi($return);
}


